<template>
    <el-dialog :title="title" :visible.sync="showModel" min-width="800px" :close-on-click-modal="false">
        <div>
            <el-form ref="authRuleForm" label-width="120px" @submit.native.prevent>
                <el-form-item label="保留房来源" prop="date">
                    <el-radio v-model="room_quantity_source" :label="1">自动获取</el-radio>
                    <el-radio v-model="room_quantity_source" :label="2">不设置</el-radio>
                </el-form-item>
            </el-form>
        </div>
        <div class="footer-button">
            <el-button @click="turnOff">取消</el-button>
            <el-button type="primary" @click="submitHandler('authRuleForm')">确认</el-button>
        </div>

    </el-dialog>
</template>
<script>
export default {
    data() {
        return {
            room_quantity_source: 1
        };
    },
    props: {
        show: {
            default: false,
            type: Boolean
        },
        type: {
            default: 'setTime',
            type: String
        },
        authData: {
            default: () => { },
            type: Object
        }
    },
    computed: {
        showModel: {
            get() {
                return this.show;
            },
            set(val) {
                this.$emit('update:show', val);
            }
        },
        title() {
            return '设置保留房来源';
        }
    },
    created() {
        console.log(this.authData);
        this.room_quantity_source = this.authData.room_quantity_source || 1
    },
    methods: {
        turnOff() {
            this.showModel = false;
        }, 
        submitHandler(form) {
            this.$emit('update', { id: this.authData.id,  room_quantity_source: this.room_quantity_source })
            this.turnOff();
        },
    },

}
</script>
<style lang="scss" scoped>
.main {
    padding: 0 0px 0 20px;
}

.footer-button {
    margin-top: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
</style>